<html>
<head><meta charset="utf-8"><title>C++ IR: IPR · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/C.2B.2B.20IR.3A.20IPR.html">C++ IR: IPR</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="201115682"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/C%2B%2B%20IR%3A%20IPR/near/201115682" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/C.2B.2B.20IR.3A.20IPR.html#201115682">(Jun 17 2020 at 08:55)</a>:</h4>
<p>Here's an interesting paper describing semantic representation for C++</p>
<p><a href="https://stroustrup.com/gdr-bs-macis09.pdf">A Principled, Complete, and Efficient Representation of C++</a></p>
<p>It seems like we might want something like this for our hir/code_model</p>



<a name="201116080"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/C%2B%2B%20IR%3A%20IPR/near/201116080" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/C.2B.2B.20IR.3A.20IPR.html#201116080">(Jun 17 2020 at 08:59)</a>:</h4>
<p>In particular, this 2000 lines header describes the whole of C++ <a href="https://github.com/GabrielDosReis/ipr/blob/master/include/ipr/interface#L1">https://github.com/GabrielDosReis/ipr/blob/master/include/ipr/interface#L1</a></p>
<p>Our code model should look like this, at least in spirit.</p>



<a name="201137969"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/C%2B%2B%20IR%3A%20IPR/near/201137969" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jeremy Kolb <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/C.2B.2B.20IR.3A.20IPR.html#201137969">(Jun 17 2020 at 13:09)</a>:</h4>
<p>I'm a little surprised that they can model the language in such an elegant way. I forget sometimes that C++ isn't as crazy as some people would like it to be.</p>



<a name="201138457"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/C%2B%2B%20IR%3A%20IPR/near/201138457" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/C.2B.2B.20IR.3A.20IPR.html#201138457">(Jun 17 2020 at 13:13)</a>:</h4>
<p>The main trick is that the IR is just a data structure. Really, when you can say that things just immutably point to each other, you get a pretty nice API. That's fundamentally incompatible with lazyness though :(</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>